﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BattleCity.GUI
{
    public class GameOverScreen : Screen
    {
        int expirationTime = 3;

        Texture2D _background;
        double _time;

        private double _goShowTime;
        public double GoShowTime
        {
            get { return _goShowTime; }
            set { _goShowTime = value; }
        }

        public event EventHandler TimeExpired;

        public GameOverScreen(Game game, Texture2D back)
            : base(game)
        {
            _sprBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
            _background = back;
        }
        public override void Update(GameTime gameTime)
        {
            _time += gameTime.ElapsedGameTime.TotalSeconds;
            if (_time >= expirationTime && TimeExpired != null)
                TimeExpired(this, new EventArgs());
            base.Update(gameTime);
        }
        public override void Draw(GameTime gameTime)
        {
            _sprBatch.Draw(_background, new Vector2(0f, 0f), null, Color.White, 0f, new Vector2(0f, 0f), 1f, SpriteEffects.None, 0.2f);
            base.Draw(gameTime);
        }
    }
}